﻿@model IEnumerable<bdxyit.com.RecruitmentAppSys.Models.AreaList>
@{
    ViewBag.Title = "大学";
    Layout = "~/Views/Shared/Search.cshtml";
}
<style type="text/css">
    .are
    {
        background:url(../Content/img/area.gif) no-repeat scroll 0 0 transparent;
        width:100px;
         height:30px;
         font-size:12px;
         line-height:12px;
        }
    .un
    {
        background:url(../Content/img/un.gif) no-repeat scroll 0 0 transparent;
        width:100px;
        height:30px;
         font-size:12px;
           line-height:12px;
        }
</style>
<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    function university(Areaid) {
        $.ajax({
            type: "get",
            url: "/Handler/AreaUniversity.ashx",
            data: "id=" + Areaid,
            beforeSend: function (XMLHttpRequest) {
                //ShowLoading();
            },
            success: function (data, textStatus) {
                tractdata(data);
            },
            complete: function (XMLHttpRequest, textStatus) {
                //HideLoading();
            },
            error: function () {
                //请求出错处理
            }
        });
    }

    function re() {
        $('#area').css("display", "");
        $("#university").html("");
        $("#university").css("display", "none");
    }

    function reva(str) {
        window.returnValue = str ;
        window.close();
     }

     function tractdata(data) {
         var univer = "";
         if (data != "" || data != null) {
             var attr = data.split("|");
            for (var i = 0; i < attr.length - 1; i++) {
                var attrbu = attr[i].split("~");
                univer = univer + "<input id='" + attr[i] + "' type='button' value=' " + attrbu[1] + " ' onclick='reva(this.id)'   class='un'/>";
            }
        } else {
           univer = "无大学";
        }
        univer = univer + "<input id='return' type='button'  value='返回重新选择'  onclick='re()'  class='un' style=' color: red'/>";
        $('#area').css("display", "none");
        $("#university").html(univer);
        $("#university").css("display", "");
     }
</script>
<h2>
    选择大学</h2>
<div  id="area">
    @foreach (var item in Model)
    {
        <input id='@item.AreaID' type="button" value="@item.AreaName"  onclick="university('@item.AreaID')"   class='are'/>
    }
</div>
<div id="university">
</div>
